package com.example.flashlight5;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.ToggleButton;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

	public void onClickToggle(View v) {
		ToggleButton tb = (ToggleButton) findViewById(R.id.toggleButton1);
		if(tb.isChecked()){
		//alternativ:	v.setBackgroundColor(0xFF000000);
			tb.setBackgroundColor(getResources().getColor(R.color.white)); // alternativ tb.setBackgroundColor(0xFFFFFFFF)
			tb.setTextColor(getResources().getColor(R.color.black)); // alternativ tb.setTextColor(0xFF000000)
			}
		else {
			tb.setBackgroundColor(getResources().getColor(R.color.black));
			tb.setTextColor(getResources().getColor(R.color.white));
		}
	}
}
